package com.example.azkabandemo.enums;

import lombok.AllArgsConstructor;


@AllArgsConstructor
/**
 * 调度执行状态枚举类
 */
public enum ScheduleStatus {
    READY("READY","就绪"),SUCCEEDED("SUCCEEDED","成功"),KILLING("KILLING","停止中"),KILLED("KILLED","已中断"),FAILED("FAILED","失败"),
    SKIPPED("SKIPPED","跳过"),DISABLED("DISABLED","停用"),QUEUED("QUEUED","等待中"),CANCELLED("CANCELLED","取消执行"),
    RUNNING("RUNNING","运行中"),PAUSED("PAUSED","暂停");

    /**
     * 状态编码
     */
    private String code;

    /**
     * 状态描述
     */
    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
    public static String getDescByCode(String code) {
        for (ScheduleStatus day:ScheduleStatus.values()) {
            if (code.equals(day.getCode())){
                return day.getDesc();
            }

        }
        return "";
    }
}
